; Music of Heavy on the Magic (1986) (Gargoyle Games)
; Ripped by Megachur the 16/06/2007

	write "HEAVYOTM.BIN"

music_date_rip	equ &1067
music_adr	equ &0f00
first_theme	equ 0
last_theme	equ 0

	read "music_header_v1_0.asm"

	dw #03bc,#0386,#0353,#0324
	dw #02f6,#02cc,#02a4,#027e
	dw #025a,#0238,#0218,#01fa
	dw #01de,#01c3,#01aa,#0192
	dw #017b,#0166,#0152,#013f
	dw #012d,#011c,#010c,#00fd
	dw #00ef,#00e1,#00d5,#00c9
	dw #00be,#00b3,#00a9,#009f
	dw #0096,#008e,#0086,#007f
	dw #0077,#0071,#006a,#0064
	dw #005f,#0059,#0054,#0050
	dw #004b,#0047,#0043,#003f
	dw #003c,#0038,#0035,#0032
	dw #002f
	db #00,#00,#ba,#03,#f8,#02,#80,#02
	db #e0,#01,#4d,#01,#38,#01,#b1,#00
.l0f7d equ $ + 3
.l0f7a
	db #7b,#ff,#00,#00
.l0f82 equ $ + 4
.l0f7e
	dw l0f7a,l1178,l0f7a,l1153
.l0f8a equ $ + 4
.l0f86
	dw l0f7a,l119d,l0f7a,l11c2
.l0f8e
	dw #0000
.l0f96 equ $ + 6
.l0f92 equ $ + 2
.l0f90
	db #00,#00,#00,#00,#00,#38,#05,#0f
.l0f9e equ $ + 6
.l0f9d equ $ + 5
.l0f9c equ $ + 4
	db #05,#00,#00,#00,#00,#f5,#04,#05
.l0fa1 equ $ + 1
	db #06,#0e,#0e,#0e,#0d,#0d,#0d,#0d
	db #0c,#0c,#0c,#0c,#0b,#0b,#0b,#0b
	db #0b,#0b,#0b,#0b,#0a,#0a,#0a,#0a
	db #0a,#09,#09,#09,#08,#08,#07,#07
	db #06,#0c,#0d,#0d,#0c,#0c,#0c,#0c
	db #0c,#0b,#0c,#0c,#0c,#0d,#0d,#0c
	db #0c,#07,#09,#0b,#0c,#0d,#0f,#0e
	db #0e,#0d,#0c,#0b,#09,#08,#07,#06
	db #05,#0c,#0c,#0c,#0c,#0c,#0c,#0c
	db #0c,#0c,#0c,#0c,#0c,#0c,#0c,#0c
	db #0c
.l0ff1
	dw l0f7a,l1178,l0f7a,l1153
	dw l0f7a
	dw l119d,l0f7a,l11c2
	db #e1,#01,#05,#02
;
.init_music
;
	ld hl,l0ff1
	ld de,l0f7e
	ld bc,#0010
	ldir
	ld de,l0f9d
	ld c,#04
	ldir
	xor a
	ld (l0f7d),a
	ret
;
.play_music
;
	di
	xor a
	ld hl,l0f9c
	ld (hl),a
	ld hl,l0f7e
	call l1070
	ld hl,l0f8e
	ld (hl),d
	inc l
	ld (hl),e
	ld hl,l0f82
	call l1070
	ld hl,l0f90
	ld (hl),d
	inc l
	ld (hl),e
	ld hl,l0f86
	call l1070
	ld hl,l0f92
	ld (hl),d
	inc l
	ld (hl),e
	ld hl,l0f8a
	call l1070
	call l10cb
	ld d,#00
	ld b,#08
	call l1107
	call l10a6
	ld a,(l0f7d)
	inc a
	cp #08
	jr nz,l1062
	xor a
.l1062
	ld (l0f7d),a
	ei
	ret
;
.stop_music
;
	ld d,#07
	ld e,#3f
	call l10e6
	ei
	ret
.l1070
	ld e,(hl)
	inc l
	ld d,(hl)
	ld a,(l0f7d)
	cp #00
	jr nz,l107b
	inc de
.l107b
	ld a,(de)
	cp #ff
	jr z,l109e
	ld (hl),d
	dec l
	ld (hl),e
	add a
	ld e,a
	ld d,#00
	ld hl,l11e7
	add hl,de
	add hl,de
	add hl,de
	add hl,de
	ld a,(l0f7d)
	ld e,a
	add hl,de
	ld a,(hl)
	ld b,a
	add a
	ld hl,l0f8e
	ld l,a
	ld d,(hl)
	inc l
	ld e,(hl)
	ret
.l109e
	inc l
	ld e,(hl)
	inc l
	ld d,(hl)
	dec l
	dec l
	jr l107b
.l10a6
	ld a,#01
	call l1115
	ld a,#02
	call l1115
	ld a,#03
	call l1115
	ld a,(l0f9d)
.l10b8
	ld b,#46
.l10ba
	nop
	djnz l10ba
	inc a
	jr nz,l10b8
	ld hl,l0f9c
	inc (hl)
	ld a,(hl)
	cp #10
	ret z
	jp l10a6
.l10cb
	ld a,b
	cp #00
	ret z
	bit 2,b
	ret z
	and #03
	ld c,a
	ld a,#e0
	and b
	rlca
	rlca
	rlca
	ld b,a
	ld d,#00
	ld e,c
	ld hl,l0f9e
	add hl,de
	dec hl
	ld (hl),b
	ret
.l10e6
	push bc
	ld b,#f4
	out (c),d
	ld b,#f6
	in a,(c)
	or #c0
	out (c),a
	and #3f
	out (c),a
	ld b,#f4
	out (c),e
	ld b,#f6
	ld c,a
	or #80
	out (c),a
	out (c),c
	pop bc
	inc d
	ret
.l1107
	ld hl,l0f8e
	ld a,d
	add l
	ld l,a
.l110d
	ld e,(hl)
	inc hl
	call l10e6
	djnz l110d
	ret
.l1115
	ld hl,l0f8e
	ld c,a
	dec l
	add l
	add c
	ld l,a
	ld a,(hl)
	dec l
	or (hl)
	ret z
	ld l,#95
	ld a,c
	add l
	ld l,a
	ex de,hl
	ld hl,#0008
	add hl,de
	ld a,(hl)
	cp #00
	ret z
	ld hl,l0fa1
	dec a
	add a
	add a
	add a
	add a
	ld d,#00
	ld e,a
	add hl,de
	ld a,(l0f9c)
	ld e,a
	add hl,de
	ld b,(hl)
	ld hl,l0f96
	ld e,c
	add hl,de
	dec l
	ld a,(hl)
	cp b
	ret z
	ld (hl),b
	ld e,b
	ld a,#07
	add c
	ld d,a
	jp l10e6
.l1153
	db #02,#02,#02,#02,#03,#04,#05,#06
	db #07,#08,#09,#0a,#0b,#0c,#0d,#0e
	db #0f,#10,#0f,#11,#12,#13,#02,#02
	db #14,#15,#16,#17,#18,#19,#1a,#1b
.l1178 equ $ + 5
	db #1c,#1d,#02,#1e,#ff,#1f,#20,#1f
	db #20,#1f,#20,#1f,#20,#1f,#20,#1f
	db #20,#1f,#20,#1f,#21,#22,#23,#22
	db #24,#1f,#20,#1f,#25,#26,#27,#28
	db #29,#2a,#2a,#2a,#2b,#2c,#2c,#2d
.l119d equ $ + 2
	db #2e,#ff,#2f,#30,#2f,#30,#2f,#30
	db #2f,#30,#2f,#30,#2f,#30,#2f,#30
	db #2f,#30,#31,#32,#31,#32,#2f,#30
	db #2f,#30,#02,#02,#02,#02,#33,#33
.l11c2 equ $ + 7
	db #34,#34,#31,#31,#2f,#2f,#ff,#35
	db #01,#01,#01,#01,#01,#01,#01,#01
	db #01,#01,#01,#01,#01,#01,#01,#01
	db #01,#01,#01,#01,#01,#01,#36,#01
	db #01,#01,#37,#01,#01,#01,#01,#38
	db #38,#01,#39,#ff
.l11e7
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #35,#35,#35,#35,#35,#35,#35,#35
	db #0c,#0c,#0c,#0c,#18,#18,#18,#18
	db #1a,#1a,#1a,#1a,#18,#18,#0c,#0c
	db #16,#16,#16,#16,#18,#18,#18,#18
	db #16,#16,#16,#16,#0a,#0a,#16,#16
	db #14,#14,#14,#14,#08,#08,#08,#08
	db #08,#08,#08,#08,#08,#0a,#0c,#0f
	db #0e,#0e,#0e,#0e,#11,#11,#11,#11
	db #13,#13,#13,#13,#0e,#0e,#0e,#0e
	db #0c,#0c,#18,#0c,#0c,#0c,#18,#0c
	db #0c,#0c,#18,#0c,#0c,#0c,#18,#1a
	db #1b,#1a,#1b,#1a,#1b,#1a,#18,#1a
	db #1b,#1a,#1b,#1a,#1d,#1d,#1d,#1d
	db #1d,#1d,#1d,#1d,#1d,#1f,#20,#1d
	db #22,#20,#1f,#20,#22,#20,#1f,#20
	db #22,#20,#1f,#1d,#1b,#19,#1b,#19
	db #18,#18,#18,#18,#0c,#0c,#0c,#0c
	db #18,#18,#18,#18,#18,#18,#18,#18
	db #30,#2b,#24,#1f,#30,#2b,#24,#1f
	db #30,#29,#24,#1d,#30,#29,#24,#1d
	db #2e,#29,#26,#22,#2e,#29,#26,#22
	db #2d,#29,#24,#1f,#1d,#1f,#21,#24
	db #00,#00,#01,#01,#02,#02,#03,#03
	db #04,#04,#05,#05,#06,#06,#07,#07
	db #08,#08,#09,#09,#0a,#0a,#0b,#0b
	db #0c,#0c,#0d,#0d,#0e,#0e,#0f,#0f
	db #10,#11,#12,#13,#14,#15,#16,#17
	db #18,#19,#1a,#1b,#1c,#1d,#1e,#1f
	db #1f,#22,#27,#2b,#30,#32,#28,#30
	db #26,#24,#27,#24,#29,#24,#2b,#24
	db #2c,#24,#2b,#24,#27,#24,#2b,#24
	db #2c,#24,#2b,#24,#27,#24,#2b,#29
	db #2b,#29,#2c,#29,#2e,#29,#30,#29
	db #31,#29,#30,#29,#2c,#29,#30,#29
	db #31,#29,#30,#29,#2c,#29,#30,#24
	db #2c,#24,#2b,#24,#27,#24,#2b,#35
	db #18,#1a,#18,#1a,#1b,#1a,#18,#1a
	db #0c,#0e,#0c,#0e,#0f,#0e,#0c,#0e
	db #16,#18,#16,#18,#1a,#18,#16,#1a
	db #18,#16,#18,#16,#18,#16,#15,#11
	db #0c,#0f,#0c,#10,#0c,#11,#0c,#12
	db #0c,#0f,#0c,#10,#18,#17,#16,#15
	db #11,#13,#14,#11,#1a,#1a,#18,#18
	db #1f,#1d,#1f,#1d,#1f,#1d,#1b,#1a
	db #18,#1b,#1f,#24,#27,#2b,#30,#33
	db #24,#26,#24,#27,#24,#29,#24,#2b
	db #24,#2c,#24,#2b,#24,#27,#24,#2b
	db #29,#2b,#29,#2c,#29,#2e,#29,#30
	db #29,#31,#29,#30,#29,#2c,#29,#30
	db #30,#24,#30,#24,#30,#24,#30,#24
	db #30,#2b,#24,#2b,#30,#2b,#24,#2b
	db #2d,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#8d
	db #00,#00,#00,#00,#00,#00,#00,#6f
	db #2a,#2a,#2a,#2a,#2a,#2a,#2a,#2a
	db #00,#00,#00,#00,#00,#00,#00,#4f
	db #58,#78,#83,#04,#bd,#17,#00,#00
	db #bd,#17,#85,#03,#35,#18,#85,#03
	db #ad,#18,#85,#03,#25,#19,#85,#03
	db #9d,#19,#85,#03,#15,#1a,#85,#03
	db #8d,#1a,#85,#03,#05,#1b,#85,#03
	db #7d,#1b,#85,#03,#f5,#1b,#85,#03
	db #6d,#1c,#85,#03,#e5,#1c,#85,#03
	db #5d,#1d,#85,#03,#d5,#1d,#85,#03
	db #4d,#1e,#85,#03,#c5,#1e,#85,#03
	db #3d,#1f,#00,#00,#3d,#1f,#82,#05
	db #8d,#1f,#85,#03,#05,#20,#85,#03
	db #7d,#20,#85,#03,#f5,#20,#85,#03
	db #6d,#21,#85,#03,#e5,#21,#85,#03
	db #5d,#22,#86,#03,#ed,#22,#81,#01
	db #f5,#22,#81,#01,#fd,#22,#81,#01
	db #05,#23,#82,#02,#25,#23,#82,#02
	db #45,#23,#85,#03,#9d,#22,#00,#00
	db #bd,#23,#85,#03,#35,#24,#85,#03
	db #ad,#24,#85,#03,#25,#25,#85,#03
	db #9d,#25,#85,#03,#15,#26,#85,#03
	db #8d,#26,#85,#03,#05,#27,#85,#03
	db #7d,#27,#85,#03,#f5,#27,#85,#03
	db #4d,#27,#00,#00,#6d,#28,#85,#03
	db #e5,#28,#85,#03,#5d,#29,#85,#03
	db #d5,#29,#81,#03,#ed,#29,#81,#03
	db #05,#2a,#85,#03,#7d,#2a,#85,#03
	db #f5,#2a,#85,#03,#6d,#2b,#85,#03
	db #e5,#2b,#85,#03,#5d,#2c,#85,#03
	db #d5,#2c,#86,#03,#65,#2d,#81,#03
	db #7d,#2d,#83,#03,#c5,#2d,#83,#03
	db #0d,#2e,#83,#03,#55,#2e,#83,#03
	db #9d,#2e,#83,#04,#fd,#2e,#82,#04
	db #3d,#2f,#82,#04,#7d,#2f,#82,#02
	db #9d,#2f,#82,#04,#dd,#2f,#83,#04
	db #3d,#30,#83,#03,#85,#30,#82,#03
	db #b5,#30,#82,#03,#e5,#30,#83,#03
	db #2d,#31,#83,#03,#75,#31,#82,#03
	db #a5,#31,#83,#03,#ed,#31,#83,#03
	db #35,#32,#83,#03,#7d,#32,#83,#03
	db #c5,#32,#83,#03,#0d,#33,#83,#03
	db #55,#33,#83,#02,#85,#33,#82,#02
	db #a5,#33,#82,#02,#c5,#33,#83,#02
	db #f5,#33,#82,#02,#15,#34,#85,#03
	db #8d,#34,#81,#03,#a5,#34,#81,#03
	db #bd,#34,#85,#03,#35,#35,#81,#03
	db #4d,#35,#83,#04,#ad,#35,#83,#04
	db #0d,#36,#83,#04,#6d,#36,#83,#03
	db #4d,#35,#00,#00,#b5,#36,#83,#03
	db #fd,#36,#84,#03,#5d,#37,#84,#03
	db #bd,#37,#82,#03,#ed,#37,#83,#03
	db #35,#38,#82,#03,#65,#38,#83,#03
	db #ad,#38,#82,#03,#dd,#38,#83,#03
	db #25,#39,#82,#03,#55,#39,#83,#03
	db #9d,#39,#82,#03,#cd,#39,#83,#03
	db #15,#3a,#84,#04,#95,#3a,#84,#04
	db #15,#3b,#84,#04,#95,#3b,#83,#03
	db #dd,#3b,#83,#03,#25,#3c,#83,#03
	db #6d,#3c,#84,#03,#cd,#3c,#81,#04
	db #ed,#3c,#85,#04,#8d,#3d,#85,#04
	db #2d,#3e,#85,#04,#cd,#3e,#85,#04
	db #6d,#3f,#84,#01,#8d,#3f,#81,#01
	db #95,#3f,#81,#01,#9d,#3f,#81,#01
	db #a5,#3f,#82,#02,#c5,#3f,#82,#02
	db #e5,#3f,#82,#02,#05,#40,#83,#03
	db #4d,#40,#83,#03,#95,#40,#87,#01
	db #cd,#40,#87,#01,#05,#41,#86,#03
	db #95,#41,#86,#03,#25,#42,#86,#03
	db #b5,#42,#86,#03,#bd,#17,#00,#00
	db #45,#43,#82,#01,#55,#43,#82,#01
	db #65,#43,#83,#04,#c5,#43,#83,#04
	db #25,#44,#83,#04,#85,#44,#83,#04
	db #e5,#44,#83,#04,#45,#45,#83,#04
	db #a5,#45,#83,#04,#05,#46,#83,#03
	db #4d,#46,#83,#03,#d5,#45,#00,#00
	db #95,#46,#83,#03,#dd,#46,#84,#04
	db #5d,#47,#84,#04,#dd,#47,#84,#04
	db #5d,#48,#84,#04,#dd,#48,#84,#04
	db #5d,#49,#84,#04,#dd,#49,#84,#04
	db #bd,#17,#00,#00,#bd,#17,#00,#00
	db #bd,#17,#00,#00,#5d,#4a,#87,#01
	db #95,#4a,#87,#01,#cd,#4a,#87,#01
	db #05,#4b,#87,#01,#15,#38,#00,#00
	db #15,#38,#00,#00,#bd,#17,#00,#00
	db #bd,#17,#00,#00,#bd,#17,#00,#00
	db #3d,#4b,#85,#02,#8d,#4b,#85,#02
	db #dd,#4b,#87,#02,#4d,#4c,#87,#02
	db #bd,#4c,#86,#03,#4d,#4d,#86,#01
	db #7d,#4d,#86,#02,#dd,#4d,#83,#03
	db #25,#4e,#90,#01,#a5,#4e,#83,#03
	db #ed,#4e,#86,#02,#bd,#17,#00,#00
	db #8d,#4e,#00,#00,#4d,#4f,#82,#03
	db #7d,#4f,#82,#03,#ad,#4f,#81,#01
	db #b5,#4f,#81,#01,#bd,#4f,#82,#02
	db #dd,#4f,#81,#01,#e5,#4f,#82,#03
	db #15,#50,#81,#01,#1d,#50,#82,#01
	db #2d,#50,#82,#03,#5d,#50,#82,#01
	db #6d,#50,#82,#03,#9d,#50,#81,#01
	db #a5,#50,#81,#01,#ad,#50,#81,#01
	db #b5,#50,#82,#03,#e5,#50,#81,#01
	db #ed,#50,#82,#02,#0d,#51,#81,#01
	db #15,#51,#83,#03,#5d,#51,#83,#03
	db #a5,#51,#83,#03,#ed,#51,#81,#01
	db #f5,#51,#82,#03,#bd,#17,#00,#00
	db #bd,#17,#00,#00,#bd,#17,#00,#00
	db #bd,#17,#00,#00,#bd,#17,#00,#00
	db #bd,#17,#00,#00,#bd,#17,#00,#00
	db #bd,#17,#00,#00,#bd,#17,#00,#00
	db #bd,#17,#00,#00,#bd,#17,#00,#00
	db #bd,#17,#00,#00,#bd,#17,#00,#00
	db #bd,#17,#00,#00,#bd,#17,#00,#00
	db #bd,#17,#00,#00,#bd,#17,#00,#00
	db #bd,#17,#00,#00,#bd,#17,#00,#00
	db #bd,#17,#00,#00,#bd,#17,#00,#00
	db #bd,#17,#00,#00,#bd,#17,#00,#00
	db #bd,#17,#00,#00,#bd,#17,#00,#00
	db #bd,#17,#00,#00,#bd,#17,#00,#00
	db #bd,#17,#00,#00,#bd,#17,#00,#00
	db #bd,#17,#00,#00,#bd,#17,#00,#00
	db #bd,#17,#00,#00,#bd,#17,#00,#00
	db #25,#52,#81,#01,#2d,#52,#83,#03
	db #75,#52,#81,#01,#7d,#52,#81,#01
	db #85,#52,#81,#01,#8d,#52,#81,#01
	db #95,#52,#82,#01,#a5,#52,#82,#02
	db #c5,#52,#82,#01,#d5,#52,#82,#03
	db #05,#53,#82,#03,#35,#53,#81,#01
	db #3d,#53,#82,#02,#5d,#53,#82,#03
	db #bd,#17,#00,#00,#bd,#17,#00,#00
	db #8d,#53,#81,#03,#a5,#53,#88,#01
	db #bd,#17,#00,#00,#28,#3c,#00,#1c
	db #00,#00,#63,#00,#00,#9c,#80,#00

.game_name
	db "Heavy on the Magic",0
.game_year
	db "1986",0
.game_publisher
	db "Gargoyle Games",0
.music_author
	db "",0
.music_comment
	db "",0

;	org #af42
;	call init_music
;.laf45
;	call play_music
;	halt
;	call #bb09
;	jr nc,laf45
;	call stop_music
;	ret

	read "music_end_v1_0.asm"
